from enum import Enum

from pydantic import BaseModel, conlist

from settings import settings


class LteConfig(BaseModel):
    amp_voltages: conlist(float, min_items=settings.SERVICES_MODULE_NUMBER,
                          max_items=settings.SERVICES_MODULE_NUMBER) = None
    sv_ref_voltage: float = 5
    power_calibration_value: float = 0

    class Config:
        validate_assignment = True


class Telemetry(BaseModel):
    is_rev_1_2: bool = False
    is_rev_1_0: bool = False
    temperature: float = 0
    voltage_28v: float = 0
    current_28v: float = 0
    preamp_5v: float = 0
    lna_5v: float = 0
    direct_power: float = 0
    reflected_power: float = 0
    bit_settings: float = 0
    crc: float = 0
    raw_message: str = ''

    class Config:
        validate_assignment = True


class GsmConfig(BaseModel):
    bias_per_transistor: float = 3.9
    sv_ref_voltage: float = 5
    power_calibration_value: float = 0

    class Config:
        validate_assignment = True


class ModuleType(str, Enum):
    LTE: str = 'LTE'
    GSM: str = 'GSM'

